package com.xzh.controller;

import com.xzh.model.search.CourseSearch;
import com.xzh.service.CoursService;
import com.xzh.util.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/v1/course")
public class CourseController {
    private CoursService coursService;
    @Autowired
    public void setCoursService(CoursService coursService){
        this.coursService = coursService;
    }

    @GetMapping("/list")
    public ResponseEntity<JsonResult<?>> selectList(){
        List<CourseSearch> courses = coursService.selectList();
        return ResponseEntity.ok(JsonResult.success(courses));
    }
}
